import Sequelize from 'sequelize';
import baseDao from '../lib/baseDao.js'; // 数据库操作
// import Order from './order.js'

const Modal = baseDao.sequelize.define('t_delivery', {
  // 属性
  id: {
    type: Sequelize.INTEGER,
    primaryKey: true, // 主键
    autoIncrement: true, // 自增
    allowNull: true,
    validate: {
      len: [1, 50]
    }
  },
  orderId: {
    type: Sequelize.INTEGER,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '订单ID'
  },
  companyCode: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '物流公司编码'
  },
  deliveryNumber: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '快递单号'
  },
}, {
    // 参数
  });

// Modal.belongsTo(Order.Modal, { foreignKey: 'orderId', targetKey: 'id', as: 'delivery' });

//向外暴露
export default {
  Modal,
}